package leetcode.code547;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

/**
 * @author CaoYu
 * @date 2021年9月2日
 * @description leetcode.code200.Solution200
 */
public abstract class Solution547 implements IDebug {

	public abstract int findCircleNum(int[][] isConnected);

	private void debug(String string, int expect) {
		int[][] grid = HelpDebug.str2array1(string);
		int result = this.findCircleNum(grid);
//		HelpDebug.printObject(grid);
		HelpDebug.compare(expect, result);
	}

	@Override
	public void debug1() {
		String string = "[[1,1,0],[1,1,0],[0,0,1]]";
		int expect = 2;
		this.debug(string, expect);
	}

	@Override
	public void debug2() {
		String string = "[[1,0,0],[0,1,0],[0,0,1]]";
		int expect = 3;
		this.debug(string, expect);
	}

	@Override
	public void debug3() {
		String string = "[[1,0,0,1],[0,1,1,0],[0,1,1,1],[1,0,1,1]]";
		int expect = 1;
//		HelpDebug.printObject(HelpDebug.str2array1(string));
		this.debug(string, expect);
	}

	@Override
	public void debug4() {
		String string = "[[1,0,0,0,0,0,0,0,0,1,0,0,0,0,0],[0,1,0,1,0,0,0,0,0,0,0,0,0,1,0],[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0],[0,1,0,1,0,0,0,1,0,0,0,1,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0],[0,0,0,1,0,0,0,1,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0,0,0],[1,0,0,0,0,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],[0,0,0,1,0,0,0,0,0,0,0,1,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0,1,0,0],[0,1,0,0,0,0,0,0,0,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]]";
		int expect = 8;
//		HelpDebug.printObject(HelpDebug.str2array1(string));
		this.debug(string, expect);

	}

}
